package org.springblade.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

/**
 * @Date 11:45 2025/5/8
 * @Description {
 *
 * }
 * @Author lsay
 **/
@Configuration
public class GlobalAsyncConfig {

	@Bean(name = "customExecutor")
	public ThreadPoolTaskExecutor customExecutor() {
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
		executor.setCorePoolSize(3);
		executor.setMaxPoolSize(5);
		executor.setQueueCapacity(10);
		executor.setThreadNamePrefix("CustomExecutor-");
		executor.initialize();
		return executor;
	}

}
